package com.yuncheng.spcyApi.constant.flow;

import com.yuncheng.spcyApi.constant.common.SpcyConstant;
import org.springframework.stereotype.Component;

@Component(value = "zltxwjFlowConstant")
public class ZltxwjFlowConstant implements FlowConstant {

    public final static String NODENAME = "申请,科室复核,分管领导,质量负责人,中心领导,修订确认,修订审核,宣贯效果评价,实施发布";

    public final static String NODENAME_SP = "申请,科室复核,分管领导,质量负责人,中心领导,修订确认,修订审核,宣贯效果评价,实施发布";

    public final static String HJMC_SQ = "申请";
    public final static String HJMC_KSFH = "科室复核";
    public final static String HJMC_FGLD = "分管领导";
    public final static String HJMC_GLZDB = "质量负责人";
    public final static String HJMC_ZXLD = "中心领导";
    public final static String HJMC_XDQR = "修订确认";
    public final static String HJMC_XDSH = "修订审核";
    public final static String HJMC_XGXGPJ = "宣贯效果评价";
    public final static String HJMC_SSFB = "实施发布";
    public final static String HJMC_XGXX = "宣贯学习"; // 修订审核-延申的子流程-宣贯学习-传阅环节

    public final static String DEFAULT_XGXX_OPINION_WXX = "未学习"; // 宣贯学习-默认意见
    public final static String DEFAULT_XGXX_OPINION_YXX = "已学习"; // 宣贯学习-默认意见
    public final static String FILE_TYPE_XGQKFJ = "宣贯情况附件"; // 文件类型-宣贯情况附件

    // 流程办理按钮类型 - 保存
    public final static String SUBMIT_TYPE_SAVE = "0";

    // 流程办理按钮类型 - 提交
    public final static String SUBMIT_TYPE_SUBMIT = "1";

    // 获取第一环节
    public  String getFirstNode(){
        String nodeNameList[] = NODENAME.split(",");
        return nodeNameList[0];
    }

    public  String getBlfs(String nodeName){
        return SpcyConstant.BLFS_DRJJ;
    }

    @Override
    public String getFywflcode() {
        return "zltxwj001";
    }

    @Override
    public String getFlowName() {
        return "质量体系文件流程";
    }

    // 获取下环节名称
    public  String getNextNodeName(String nowNodeName){
        String nodeNameList[] = NODENAME.split(",");
        for (int i=0; i<nodeNameList.length; i++){
            if (nodeNameList[i].equals(nowNodeName)){
                if (i == nodeNameList.length-1){
                    return HJMC_LCJS;
                }else {
                    return nodeNameList[i+1];
                }
            }
        }
        return "";
    }

    // 获取上一个环节名称
    public String getPreviousName(String nowNodeName){
        String[] nodeNameList = NODENAME.split(",");

        for (int i=0; i<nodeNameList.length; i++){
            if (nodeNameList[i].equals(nowNodeName)){
                if (i==0){
                    return nodeNameList[i];
                }else {
                    int perviousI = i-1; // 上一个环节名称
                    return nodeNameList[perviousI];
                }
            }
        }
        return "";
    }

    // 获取审评下环节名称
    public String getSpNextNodeName(String nowNodeName){
        String nodeNameList[] = NODENAME_SP.split(",");
        for (int i=0; i<nodeNameList.length; i++){
            if (nodeNameList[i].equals(nowNodeName)){
                if (i == nodeNameList.length-1){
                    return HJMC_LCJS;
                }else {
                    return nodeNameList[i+1];
                }
            }
        }
        return "";
    }

    // 获取审评上环节名称
    public String getSpPreviousName(String nowNodeName){
        String[] nodeNameList = NODENAME_SP.split(",");

        for (int i=0; i<nodeNameList.length; i++){
            if (nodeNameList[i].equals(nowNodeName)){
                if (i==0){
                    return nodeNameList[i];
                }else {
                    int perviousI = i-1; // 上一个环节名称
                    return nodeNameList[perviousI];
                }
            }
        }
        return "";
    }
}
